#include<stdio.h>
int main()
{
	long int x,y,z;
	scanf("%ld %ld",&x,&y);
	if(0==y%x)
	{
		z=x+y;
	}
	else
	{
		z=y-x;
	}
	printf("%ld",z);
	return 0;
}
